{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1cc1e9d7",
   "metadata": {},
   "source": [
    "* 本学习记录人：许智超\n",
    "* 学习时间：2021-12-21\n",
    "* week17\n",
    "* 参考的文档：\n",
    "\n",
    "> 1.[python官方文档](https://python.org/doc)\n",
    "\n",
    "> 2.[许老师博客](https://cnblogs.com/xuzhichao)\n",
    "\n",
    "> 3.[bootstrap框架](https://getbootstrap.com/)\n",
    "\n",
    "# 尝试完成期末项目"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "37a11aa5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting Flask\n",
      "  Downloading Flask-2.0.2-py3-none-any.whl (95 kB)\n",
      "\u001b[K     |████████████████████████████████| 95 kB 1.8 MB/s  eta 0:00:01\n",
      "\u001b[?25hCollecting Werkzeug>=2.0\n",
      "  Downloading Werkzeug-2.0.2-py3-none-any.whl (288 kB)\n",
      "\u001b[K     |████████████████████████████████| 288 kB 67.2 MB/s eta 0:00:01\n",
      "\u001b[?25hRequirement already satisfied: Jinja2>=3.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from Flask) (3.0.1)\n",
      "Collecting click>=7.1.2\n",
      "  Downloading click-8.0.3-py3-none-any.whl (97 kB)\n",
      "\u001b[K     |████████████████████████████████| 97 kB 2.4 MB/s  eta 0:00:01\n",
      "\u001b[?25hCollecting itsdangerous>=2.0\n",
      "  Downloading itsdangerous-2.0.1-py3-none-any.whl (18 kB)\n",
      "Requirement already satisfied: importlib-metadata in /srv/conda/envs/notebook/lib/python3.6/site-packages (from click>=7.1.2->Flask) (4.6.3)\n",
      "Requirement already satisfied: MarkupSafe>=2.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from Jinja2>=3.0->Flask) (2.0.1)\n",
      "Requirement already satisfied: dataclasses in /srv/conda/envs/notebook/lib/python3.6/site-packages (from Werkzeug>=2.0->Flask) (0.8)\n",
      "Requirement already satisfied: zipp>=0.5 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from importlib-metadata->click>=7.1.2->Flask) (3.5.0)\n",
      "Requirement already satisfied: typing-extensions>=3.6.4 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from importlib-metadata->click>=7.1.2->Flask) (3.10.0.0)\n",
      "Installing collected packages: Werkzeug, itsdangerous, click, Flask\n",
      "Successfully installed Flask-2.0.2 Werkzeug-2.0.2 click-8.0.3 itsdangerous-2.0.1\n"
     ]
    }
   ],
   "source": [
    "!pip install Flask"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ebd8e586",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " * Serving Flask app '__main__' (lazy loading)\n",
      " * Environment: production\n",
      "\u001b[31m   WARNING: This is a development server. Do not use it in a production deployment.\u001b[0m\n",
      "\u001b[2m   Use a production WSGI server instead.\u001b[0m\n",
      " * Debug mode: off\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\n"
     ]
    }
   ],
   "source": [
    "from flask import Flask,request\n",
    "from flask import render_template\n",
    "\n",
    "# flask角色： 中央登记中心\n",
    "# 1. 路由 route：\n",
    "# 1.1  url 相对路径：不完整的路径（相对于IP地址的路径，所以IP地址和端口号不需要写）；\n",
    "#    绝对路径是完整路径。\n",
    "# 1.2  request 的请求方法：【GET默认】【POST】\n",
    "# 2  视图函数\n",
    "\n",
    "app = Flask(__name__)\n",
    "\n",
    "# [GET默认]\n",
    "\n",
    "@app.route(\"/\")\n",
    "def simplifyit():\n",
    "    return render_template(\"simple.html\")\n",
    "\n",
    "@app.route(\"/index\")\n",
    "def index():\n",
    "    return render_template('index.html')\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    app.run()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a5030172",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
